import time
from datetime import datetime
from datetime import timedelta


def time_func():
    today = time.localtime()
    # 查看时间
    print(f"当前时间：{today}")
    # 获取时间戳
    print(f"从1970年1月1日（UTC/GMT的午夜）开始所经过的秒数{time.time()}")
    # 时间格式转换
    print(f'''{today}---->{time.strftime("%Y-%m-%d %H:%M:%S", today)}''')
    print(f'''2020-11-15 13:26:41---->{time.strptime("2020-11-15 13:26:41", "%Y-%m-%d %H:%M:%S")}''')
    # time.struct_time ----> tuple
    print(tuple(today))


def get_date(days):
    days = int(days)
    now_days = datetime.today()
    request_days = now_days + timedelta(days=days)
    print(f'''{request_days.strftime("%Y-%m-%d")}''')
    return request_days.strftime("%Y-%m-%d")


if __name__ == '__main__':
    days_list = [-2, 3, 4, 5]
    for i in days_list:
        get_date(i)
